﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Windows.Phone.Storage.SharedAccess;

namespace MS.TravelJourney.Final.Core
{
    public class AssociationUriMapper : UriMapperBase
    {
        private string tempUri;

        public override Uri MapUri(Uri uri)
        {
            #region Hello
            tempUri = System.Net.HttpUtility.UrlDecode(uri.ToString());
            if (tempUri.Contains("travel:"))
            {
                int nameIndex = tempUri.IndexOf("travel:") + 7;
                string name = tempUri.Substring(nameIndex, tempUri.Length - nameIndex);
                return new Uri("/ItemDetail.xaml?name=" + name, UriKind.Relative);
            }
            return uri;
            #endregion
            
        }
    }
}
